package guda.house.dal.dao.impl;

import guda.grape.autogen.common.BaseDAO;
import guda.house.dal.dao.WxSuiteRelDAO;
import guda.house.dal.dataobject.WxSuiteRelDO;
import guda.grape.autogen.common.page.BaseQuery;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class WxSuiteRelDAOImpl extends BaseDAO implements WxSuiteRelDAO {

    @Override
	public Long insert(WxSuiteRelDO wxSuiteRel) {
	      try {
                return (Long) getSqlMapperW().insert("wx_suite_rel.insert",wxSuiteRel);
          } catch (Exception e) {
                throw new RuntimeException(e);
          }

	}

    @Override
	public WxSuiteRelDO getWxSuiteRelById(Long relId) {
	    return (WxSuiteRelDO)getSqlMapClientTemplate().queryForObject("wx_suite_rel.getWxSuiteRelById", relId);
	}

    @Override
	public boolean delWxSuiteRelById(Long relId) {
	    int num = 0;
        try {
            num = getSqlMapperW().delete("wx_suite_rel.delWxSuiteRelById",relId);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        if(num>0){
            return true;
        }else{
            return false;
        }
	}

    @Override
	public List<WxSuiteRelDO> getWxSuiteRelByIds(List idsList) {
        Map m = new HashMap();
        m.put("idsList",idsList);
		return getSqlMapClientTemplate().queryForList("wx_suite_rel.selectByIds", m);
	}

    @Override
	public void cleanAutoIncrement(Long relId) {
	    try {
            getSqlMapperW().update("wx_suite_rel.cleanAutoIncrement",relId);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
	}

    @Override
    public List<WxSuiteRelDO> selectForPage(BaseQuery baseQuery) {
        return getSqlMapClientTemplate().queryForList("wx_suite_rel.selectForPage", baseQuery);
    }

    @Override
    public int countForPage(BaseQuery baseQuery) {
        return (Integer)getSqlMapClientTemplate().queryForObject("wx_suite_rel.countForPage",baseQuery);
    }

    @Override
    public void updateByIdSelective(WxSuiteRelDO wxSuiteRel) {
        try {
            getSqlMapperW().update("wx_suite_rel.updateByIdSelective",wxSuiteRel);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    @Override
    public List<WxSuiteRelDO> getWxSuiteRelByUnionId(String unionid) {
        return getSqlMapClientTemplate().queryForList("wx_suite_rel.getWxSuiteRelByUnionId", unionid);
    }

    @Override
    public List<WxSuiteRelDO> getWxSuiteRelByOpenId(String openId) {
        return getSqlMapClientTemplate().queryForList("wx_suite_rel.getWxSuiteRelByOpenId", openId);
    }

    @Override
    public List<WxSuiteRelDO> getWxSuiteRelBySuiteId(Long suiteId) {
        return getSqlMapClientTemplate().queryForList("wx_suite_rel.getWxSuiteRelBySuiteId", suiteId);
    }


}

